        import mx.messaging.events.MessageEvent;
        import mx.messaging.messages.AsyncMessage;
        import mx.controls.Alert;
    
        private function sendChatMessage():void
        {
            var msg:AsyncMessage = new AsyncMessage();
            msg.body = " Toto says: " + chat_input_simple.htmlText;
            chatPublisher.send(msg);
            chat_input_simple.text = "";
        }

        private function sendRichChatMessage():void
        {
            var msg:AsyncMessage = new AsyncMessage();
            msg.body = " Toto says: " + chat_input_rich.htmlText;
            chatPublisher.send(msg);
            chat_input_rich.text = "";
        }

        private function receiveChatMessage(msgEvent:MessageEvent):void
        {
            var msg:AsyncMessage = AsyncMessage(msgEvent.message);
            chat_log.htmlText += msg.body;
        }
        
        // auto scolling for Output window
		public function setScroll():void 
		{
 		    chat_log.verticalScrollPosition = chat_log.maxVerticalScrollPosition;		     
		}